<script src="js/graphics.js"></script>
<div class="gameMenu centered">
	<form action="index.php?module=rules" method="post">
		<h5>Avant de commencer... Comment vous sentez-vous ?</h5>
		<div class="inlineBlock centered">
			<?php
				require_once("classes/HumeurDatabase.class.php");
				$db = new HumeurDatabase();
				$allMoods = $db->query("SELECT * FROM moods ORDER BY position ASC");
				$i = ceil(mysql_num_rows($allMoods) / 2);
				while($mood = mysql_fetch_assoc($allMoods)){
					$i--;
					$selected = ($i == 0);
			?>
			<div class="buttonBloc leftFloat">
				<label for="<?php echo $mood['moodName']; ?>"><img src="img/moods/<?php echo $mood['picture']; ?>" alt="<?php echo $mood['moodName']; ?>"/></label>
				<br/>
				<input id="<?php echo $mood['moodName']; ?>" type="radio" name="moodId" value="<?php echo $mood['moodName']; ?>" <?php if($selected) echo "checked"; ?>/>
			</div>
			<?php
				}
			?>
		</div><br/>
        <h5>Avec quelle forme souhaitez vous jouer ?</h5>
		<div class="inlineBlock centered">
			<?php
				$allShapes = $db->selectAll("shapes");
				$selected = false;
				while($shape = mysql_fetch_assoc($allShapes)){
			?>
			<div class="buttonBloc leftFloat">
				<label for="<?php echo $shape['shapeName']; ?>"><div id="div<?php echo $shape['shapeName']; ?>"></div></label>
                <?php echo '<script>document.getElementById("div'.$shape['shapeName'].'").appendChild('.$shape['javascriptFunction'].'(0,0,0,"'.uniqid().'",50));</script>'; ?>
				<br/>
				<input id="<?php echo $shape['shapeName']; ?>" type="radio" name="shapeName" value="<?php echo $shape['shapeName']; ?>" <?php if(!$selected) echo "checked"; ?>/>
			</div>
			<?php
					$selected = true;
				}
			?>
		</div><br/>
		<input type="submit" value="Jouer !" name="gameStart"/>
	</form>
</div>
